package com.bll.imple.bbsAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bean.BbsBean;
import com.bll.Action;
import com.dao.BbsDao;


public class AddBbsAction implements Action{
	
	public String execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		
		String path=request.getServletPath();
		String name=request.getParameter("name");
		String tel=request.getParameter("tel");
		String info=request.getParameter("info");
		String lujing=request.getParameter("lujing");
		//int userId=1;
		int userId=Integer.parseInt(request.getParameter("userId"));
		BbsDao dao=new BbsDao();
		BbsBean bean=new BbsBean();
		bean.setInfo(info);
		bean.setName(name);
		bean.setTel(tel);
		bean.setUserid(userId);
		int n=dao.addBbs(bean);
		if(n>0){
			return lujing+"?lujing="+request.getParameter("lujing1");
			
		}else{
			return "geiwoliuyan.jsp";
		}
//		if(lujing.equals("geiwoliuyan")){
//			
//			return "geiwoliuyan.jsp";
//			
//		}else{
//			
//			return "shouye.jsp?id="+userId;
//		}
	
		//return "geiwoliuyan.jsp";
			
	}
}
